package doyouknow.group.CnAndZhb.service.impl;

import doyouknow.group.CnAndZhb.entity.TblMenuNavigation;
import doyouknow.group.CnAndZhb.dao.master.TblMenuNavigationDao;
import doyouknow.group.CnAndZhb.service.TblMenuNavigationService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (TblMenuNavigation)表服务实现类
 *
 * @author cn
 * @since 2020-11-03 20:50:41
 */
@Service("tblMenuNavigationService")
public class TblMenuNavigationServiceImpl implements TblMenuNavigationService {
    @Resource
    private TblMenuNavigationDao tblMenuNavigationDao;

    /**
     * 通过ID查询单条数据
     *
     * @param menunavigationidx 主键
     * @return 实例对象
     */
    @Override
    public TblMenuNavigation queryById(Integer menunavigationidx) {
        return this.tblMenuNavigationDao.queryById(menunavigationidx);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<TblMenuNavigation> queryAllByLimit(int offset, int limit) {
        return this.tblMenuNavigationDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param tblMenuNavigation 实例对象
     * @return 实例对象
     */
    @Override
    public TblMenuNavigation insert(TblMenuNavigation tblMenuNavigation) {
        this.tblMenuNavigationDao.insert(tblMenuNavigation);
        return tblMenuNavigation;
    }

    /**
     * 修改数据
     *
     * @param tblMenuNavigation 实例对象
     * @return 实例对象
     */
    @Override
    public TblMenuNavigation update(TblMenuNavigation tblMenuNavigation) {
        this.tblMenuNavigationDao.update(tblMenuNavigation);
        return this.queryById(tblMenuNavigation.getMenunavigationidx());
    }

    /**
     * 通过主键删除数据
     *
     * @param menunavigationidx 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer menunavigationidx) {
        return this.tblMenuNavigationDao.deleteById(menunavigationidx) > 0;
    }
}